package com.xx.doublexchat.common.chat.service.impl;

import com.xx.doublexchat.common.chat.domain.dto.PushMessageDTO;
import com.xx.doublexchat.common.chat.service.IPushService;
import com.xx.doublexchat.common.websocket.domain.vo.resp.WSBaseResponse;
import constant.MQConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import service.MQProducer;

import java.util.List;

@Service
public class PushServiceImpl implements IPushService {

    /**
     * 消息队列发送者
     */
    @Autowired
    private MQProducer mqProducer;

    @Override
    public void sendPushMsg(WSBaseResponse<?> msg, List<Long> uidList) {
        mqProducer.sendMsg(MQConstant.PUSH_TOPIC, new PushMessageDTO(uidList, msg));
    }

    @Override
    public void sendPushMsg(WSBaseResponse<?> msg, Long uid) {
        mqProducer.sendMsg(MQConstant.PUSH_TOPIC, new PushMessageDTO(uid, msg));
    }

    @Override
    public void sendPushMsg(WSBaseResponse<?> msg) {
        mqProducer.sendMsg(MQConstant.PUSH_TOPIC, new PushMessageDTO(msg));
    }
}
